package com.zhongen.admin.api.feign;

import com.zhongen.admin.api.entity.SysDept;
import com.zhongen.common.core.constant.SecurityConstants;
import com.zhongen.common.core.constant.ServiceNameConstants;
import com.zhongen.common.core.util.R;
import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.cloud.openfeign.SpringQueryMap;
import org.springframework.web.bind.annotation.*;

import java.util.List;

@FeignClient(contextId = "remoteDeptService", value = ServiceNameConstants.UPMS_SERVICE)
public interface RemoteDeptService {

	/**
	 * 查询部门列表
	 * @return 树
	 */
	@GetMapping(value = "/dept/tree/listDescendant")
	List<SysDept> listDescendant(@RequestParam("deptId") Long deptId,
			@RequestHeader(SecurityConstants.FROM) String from);

	/**
	 * 查询所有子节点和父节点 （包含当前节点）
	 * @param deptId 部门ID 目标部门ID
	 * @return ID
	 */
	@GetMapping(value = "/dept/tree/listDescendantAndParent")
	List<SysDept> listDescendantAndParent(@RequestParam("deptId") Long deptId,
			@RequestHeader(SecurityConstants.FROM) String from);

	/**
	 * 查询部门列表
	 * @return list
	 */
	@PostMapping(value = "/dept/innerGetDeptList")
	List<SysDept> innerGetDeptList(@RequestHeader(SecurityConstants.FROM) String from);

	@PostMapping(value = "/dept/innerSave")
	R save(SysDept sysDept, @RequestHeader(SecurityConstants.FROM) String from);

	@PostMapping(value = "/dept/queryByDeptId/{id}")
	R<SysDept> queryByDeptId(@PathVariable("id") Long id, @RequestHeader(SecurityConstants.FROM) String from);

	@PostMapping(value = "/dept/innerUpdate")
	boolean innerUpdate(SysDept sysDept, @RequestHeader(SecurityConstants.FROM) String from);

}
